package com.meida.boot.handler.collecon;

import com.meida.common.mybatis.entity.EntityMap;
import com.meida.common.mybatis.interceptor.PageInterceptor;
import com.meida.common.mybatis.model.PageParams;
import com.meida.common.mybatis.query.CriteriaQuery;
import com.meida.common.utils.FlymeUtils;
import com.meida.module.product.client.entity.ProdProduct;
import com.meida.module.system.client.entity.SysColleconGroup;
import org.springframework.stereotype.Component;

/**
 * 收藏的商品
 *
 * @author zyf
 */
@Component("productColleconHandler")
public class ProductColleconHandler implements PageInterceptor {


    @Override
    public void prepare(CriteriaQuery cq, PageParams pageParams, EntityMap params) {
        String productName = params.get("productName");
        cq.addSelect("product.productName title", "product.coverImage coverImage","product.productPrice","product.productScore");
        cq.like("productName", productName);
        cq.eq("optType", 1);
        cq.eq("targetEntity", ProdProduct.class.getSimpleName());
        cq.createJoin(ProdProduct.class).setMainField("targetId");
    }


}
